package com.flying.keyword.fina;

/**
 * @ClassName: Person
 * @author: 刘鹏飞
 * @date 18:00
 * @Description: final修饰成员变量
 */
public class Person {

    private String name;
    private int age;
    private String addr;
    public static final int x = 10;   //  成员变量在声明是直接赋值
    private int z;

    {   //  直接在构造代码块里赋值
        z = 67;
    }


    private/* final*/ int y;      //  成员常量在声明时没有赋值

    //    public Person(){};
    public Person(int y) {
        this.y = y;           //   在构造方法里给成员常量赋值
    }

    public void demo() {
        System.out.println("demo");
    }

    public final void test() {
        System.out.println("test");

    }

    public Person() {
    }

    public Person(String name, int age,String addr) {
        this.name = name;
        this.age = age;
        this.addr=addr;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }
}
